﻿using System;
using System.Configuration;
using System.Diagnostics;
using OrkutAPILibrary;
using OrkutAPILibrary.Enums;

namespace OrkutAPILibrarySample
{
    class Program
    {
        static void Main()
        {
            var orkutLibrary = OrkutLibrary.Initialize(ApplicationEnvironment.Desktop, new TokenManager
                                                                                           {
                                                                                               ConsumerKey =
                                                                                                   ConfigurationManager.
                                                                                                   AppSettings[
                                                                                                       "CONSUMER_KEY"],
                                                                                               ConsumerSecret =
                                                                                                   ConfigurationManager.
                                                                                                   AppSettings[
                                                                                                       "CONSUMER_SECRET"
                                                                                                   ]
                                                                                           },
                                                       ConfigurationManager.AppSettings["TOKEN_KEY"]);
            if (orkutLibrary.IsAuthorizationNeeded)
            {
                var urlForAuthorization = orkutLibrary.GetUrlForAuthorization();
                Process.Start(urlForAuthorization.AbsoluteUri);
                Console.WriteLine("Enter the verifier code: ");
                var verifierCode = Console.ReadLine();
                orkutLibrary.Authorize(verifierCode);
            }
            var orkutPerson = orkutLibrary.GetSelfProfile();


            Console.WriteLine("This is YOUR Profile");
            Console.WriteLine(Environment.NewLine + "Your name is " + orkutPerson.DisplayName);
            Console.WriteLine(Environment.NewLine + "You are a " + orkutPerson.Gender);
            Console.WriteLine(Environment.NewLine + "living in " + orkutPerson.CurrentLocation.Region);
            Console.WriteLine(Environment.NewLine + "which is in a great country called " + orkutPerson.CurrentLocation.Country);
            Console.WriteLine(Environment.NewLine + "Something more about you - " + orkutPerson.AboutMe);
            Console.ReadLine();
        }
    }
}
